package com.zwh.mangomall.mapper;

import com.zwh.mangomall.pojo.MangoUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserInfoMapper{

    @Insert("insert into mangomall.mango_user" +
            "(mango_id, username, password, salt, phone, gender, id_card, birthday, email, user_status, created_user, created_time, modified_user, modified_time)" +
            "values(#{mangoUser.mangoId}, #{mangoUser.username}, #{mangoUser.password}, #{mangoUser.salt}, #{mangoUser.phone}, #{mangoUser.gender}, #{mangoUser.idCard}, #{mangoUser.birthday}, #{mangoUser.email}, #{mangoUser.userStatus}, #{mangoUser.createdUser}, #{mangoUser.createdTime}, #{mangoUser.modifiedUser}, #{mangoUser.modifiedTime})")
    Integer insertMangoUser(@Param("mangoUser") MangoUser mangoUser);

    @Select("select phone from mangomall.mango_user where phone=#{phone}")
    String selectPhone(String phone);

    @Select("select user_status from mangomall.mango_user where phone=#{phone}")
    Integer selectStatus(String phone);

    @Select("select * from mangomall.mango_user where phone=#{phone}")
    MangoUser selectMangoUserDetail(String phone);

}
